class RsCode:
    """
    状态码，方便直接.出来
    """
    SUCCESS = (200, '成功')
    ARGS_ERROR = (400, '参数校验失败')
    LOGIN_FAIL = (401, '账号或密码错误')
    NO_LOGIN = (402, '用户未登录或登录已过期')
    HAS_ENTRY = (403, '已报名，请勿重复报名')
    RECORD_NOT_EXISTS = (404, '记录不存在')
    NO_QUOTA = (405, '本期名额已满，敬请期待下期活动')
    INVALID_TIME = (406, '当前时间不在活动时间内')
    MAX_IMAGE = (407, '图片数量超过上传限制')
    CHECK_STATE_ERROR = (408, '当前状态不能修改')
    LACK_CHECK_DATA = (409, '缺少审核资料')
    CAN_NOT_UPDATE_ADDRESS = (410, '不能修改收货地址')
    REAL_NAME_FAIL = (411, '实名认证失败')
    REAL_NAME_LIMIT = (412, '今日实名认证次数已达上限，请明日再试！')
    ID_CARD_ERROR = (413, '身份证号码格式错误')
    WECHAT_LOGIN_FAIL = (414, '微信授权失败')
    GET_ACCESS_TOKEN_FAIL = (415, '获取微信access_token失败')
    GET_JSAPI_TICKET_FAIL = (416, '获取微信jsapi_ticket失败')
    TOO_OFTEN = (417, '服务器繁忙，请稍候再试')
    HIGH_MESSAGE_FRE = (418, '发送短信频率太快，请稍候再试')
    CODE_ERROR = (419, '验证码错误')
    NO_ENTRY = (420, '请先报名后再来')
    LOGIN_LIMIT = (421, '您登录失败次数过多，请稍后再试')
    OTHER_ERR = (500, '其他错误')
    SERVER_BUSY = (999, '服务器繁忙')


def rscode_response(rs_code=RsCode.SUCCESS, data=None, new_msg=None):
    code, msg = rs_code

    if new_msg:
        msg = new_msg

    if code == 200:
        return {'rsCode': code, 'rsData': data, 'msg': msg}

    return {'rsCode': code, 'msg': msg, 'rsData': data}
